#include <iostream>
#include <fstream>
#include <ctime>
using namespace std;

void bubbleSort(int massiv[]) {
	for (int h = 4999; h>0; h--)
	{
		for (int j=0; j <h; j++)
		{
			if (massiv[j] > massiv[j + 1])
			{
				int r = massiv[j];
				massiv[j] = massiv[j + 1];
				massiv[j + 1] = r;
			}
				
		}
	}
}

int main()
{
	
	int massiv[5000];
	ifstream a("m1_sorted.txt");
	for (int i = 0; i < 5000; i++)
	{
		a >> massiv[i];
	}
	clock_t nastya = clock();
	bubbleSort(massiv);
	clock_t nastya1 = clock();
	cout <<"m1_sorted " << nastya1 - nastya << " milliseconds" << endl;
	int massiv1[5000];
	ifstream a1("m2_reverse.txt");
	for (int i = 0; i < 5000; i++)
	{
		a1 >> massiv1[i];
	}
	nastya = clock();
	bubbleSort(massiv1);
	nastya1 = clock();
	cout << "m2_reverse " << nastya1 - nastya << " milliseconds"<< endl;
	int massiv2[5000];
	ifstream a2("m3_shuffle.txt");
	for (int i = 0; i < 5000; i++)
	{
		a2 >> massiv2[i];
	}
	nastya = clock();
	bubbleSort(massiv2);
	nastya1 = clock();
	cout << "m3_shuffle " << nastya1 - nastya << " milliseconds";
}



